package com.fsm.system.controller;

import com.fsm.common.log.config.LogData;
import com.fsm.common.log.entity.dto.OperationEnum;
import com.fsm.common.log.entity.dto.SystemTypeEnum;
import com.fsm.common.tools.Result.Result;
import com.mybatisflex.core.paginate.Page;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import com.fsm.system.entity.TRoleMenu;
import com.fsm.system.service.TRoleMenuService;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import java.io.Serializable;
import java.util.List;

/**
*  角色菜单关系控制层。
*
* @author
* @since
*/
@RestController
@Tag(name = "角色菜单关系")
@RequestMapping("/tRoleMenu")
public class TRoleMenuController {

	@Autowired
	private TRoleMenuService systemUserService;

	/**
    * 添加角色菜单关系
    *
    * @param tRoleMenu
    * @return
    */
	@LogData(value = "添加角色菜单关系",operation = OperationEnum.INSERT,systemTypeEnum = SystemTypeEnum.BACKEND)
    @PostMapping("addTRoleMenu")
    @Operation(summary="添加角色菜单关系",description="添加角色菜单关系")
    public Result addTRoleMenu(@RequestBody TRoleMenu tRoleMenu) throws Exception{
		return systemUserService.addTRoleMenu(tRoleMenu);
	}

	/**
	* 删除角色菜单关系
	*
	* @param tRoleMenu
	* @return
	*/
	@LogData(value = "删除角色菜单关系",operation = OperationEnum.DELETE,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("deleteTRoleMenu")
	@Operation(summary="删除角色菜单关系",description="删除角色菜单关系")
	public Result deleteTRoleMenu(@RequestBody TRoleMenu tRoleMenu) throws Exception{
		return systemUserService.deleteTRoleMenu(tRoleMenu);
	}

	/**
	* 更新角色菜单关系
	*
	* @param tRoleMenu
	* @return
	*/
	@LogData(value = "更新角色菜单关系",operation = OperationEnum.UPDATE,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("updateTRoleMenu")
	@Operation(summary="更新角色菜单关系",description="更新角色菜单关系")
	public Result updateTRoleMenu(@RequestBody TRoleMenu tRoleMenu) throws Exception{
		return systemUserService.updateTRoleMenu(tRoleMenu);
	}

	/**
	* 分页查询角色菜单关系
	*
	* @param tRoleMenu
	* @return 分页对象
	*/
	@LogData(value = "分页查询角色菜单关系",operation = OperationEnum.SELECT,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("pageTRoleMenu")
	@Operation(summary="分页查询角色菜单关系",description="分页查询角色菜单关系")
	public Result pageTRoleMenu(@RequestBody TRoleMenu tRoleMenu) throws Exception{
		return systemUserService.pageTRoleMenu(tRoleMenu);
	}

	/**
	* 查询角色菜单关系列表
	*
	* @param tRoleMenu
	* @return 分页对象
	*/
	@LogData(value = "查询角色菜单关系列表",operation = OperationEnum.SELECT,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("getTRoleMenuList")
	@Operation(summary="查询角色菜单关系列表",description="查询角色菜单关系列表")
	public Result getTRoleMenuList(@RequestBody TRoleMenu tRoleMenu) throws Exception{
		return systemUserService.getTRoleMenuList(tRoleMenu);
	}

	/**
	* 通过ID查询角色菜单关系
	*
	* @param tRoleMenu
	* @return
	*/
	@LogData(value = "通过ID查询角色菜单关系",operation = OperationEnum.SELECT,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("getTRoleMenuById")
	@Operation(summary="通过ID查询角色菜单关系",description="通过ID查询角色菜单关系")
	public Result getTRoleMenuById(@RequestBody TRoleMenu tRoleMenu) throws Exception{
		return systemUserService.getTRoleMenuById(tRoleMenu);
	}

}
